-
Notifications
You must be signed in to change notification settings - Fork 8k
net: coap_client: Add optional payload callback for uploads #97107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
During block uploads, the server may respond with Block 1 option with a smaller block size than currently used (so called block size negotiation). The CoAP client however did not read the Block 1 option from the response, therefore ignoring the server request to lower the block size. Signed-off-by: Robert Lubos <[email protected]>
Add an optional payload callback field to the coap_client_request structure, allowing the application to provide blocks of payload interactively during the resource upload, instead of having to provide entire payload in a single contigunous memory space. If registered, the CoAP client library will call the payload callback whenever a new PUT/POST message is being generated (note this is also true for retransmissions) instead of using the payload pointer/length. If the payload callback is NULL, then the library operates as usual. Signed-off-by: Robert Lubos <[email protected]>
Add a new sample demonstrating various ways of performing CoAP uploads with the CoAP Client library: * short uploads with payload pointer * short uploads with payload callback * block transfer uploads with payload pointer * block transfer uploads with payload callback The resource names have been chosen so that the sample can run out of the box against the Zephyr's CoAP server sample. Signed-off-by: Robert Lubos <[email protected]>
f033929
to
e2f2a01
Compare
Document the usage of the payload callback in the CoAP client documentation page. Signed-off-by: Robert Lubos <[email protected]>
Add release notes entry covering the new CoAP client payload callback. Signed-off-by: Robert Lubos <[email protected]>
e2f2a01
to
7a8a65d
Compare
provide a single contiguous buffer with the entire payload. An example callback, providing the | ||
content of the Lorem Ipsum string can look like this: | ||
|
||
.. code-block:: c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate to whine about this, but I dislike the fact that our code samples in the documentation do not adhere to our code style (tabs vs spaces). And it's an annoyance to do it properly, because rst file uses spaces for indentation, while our c code uses tabs.
I worked around this by using literalinclude::
directives instead of inline code, but that isn't ideal either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but that probably would need to be brought to a broader audience, it's everywhere like this from what I see, it's not only this file.
|
The main purpose of this PR is to add support for optional payload callback for CoAP client uploads. Additionally:
Resolves #59571